home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / LIB / HV_LINE.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  3.2 KB  |  112 lines

  1. package sub_arctic.lib;
  2.  
  3. import sub_arctic.output.loaded_image;
  4. import sub_arctic.output.drawable;
  5. import java.awt.Image;
  6.  
  7. /**
  8.  * This object simply displays a horizontal or vertical line (suitable for
  9.  * use as a separator) on the screen.  It has no input behavior.<p>
  10.  *
  11.  * @author Scott Hudson
  12.  */
  13. public class hv_line extends base_interactor {
  14.  
  15.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  16.  
  17.   /** 
  18.    * Full constructor.
  19.    * @param int          x        the x coordinate of the line
  20.    * @param int          y        the y coordinate of the line
  21.    * @param boolean      is_horz  whether this line is horizontal or vertical.
  22.    * @param int          len      length of the line
  23.    */
  24.   public hv_line(int x, int y, boolean is_horz, int len)
  25.     {
  26.       super(x,y, is_horz?len:1, is_horz?1:len);
  27.  
  28.       _is_horiz = is_horz;
  29.     }
  30.  
  31.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  32.  
  33.   /** 
  34.    * Simple constructor assuming a 0,0 position.
  35.    *
  36.    * @param boolean      is_horz  whether this line is horizontal or vertical.
  37.    * @param int          len      length of the line
  38.    */
  39.   public hv_line(boolean is_horz, int len)
  40.     {
  41.       this(0,0, is_horz, len);
  42.     }
  43.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  44.  
  45.   /** 
  46.    * Simple constructor assuming a 0,0 position and default (temp) length.
  47.    *
  48.    * @param boolean      is_horz  whether this line is horizontal or vertical.
  49.    */
  50.   public hv_line(boolean is_horz)
  51.     {
  52.       this(0,0, is_horz, 17);
  53.     }
  54.  
  55.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  56.  
  57.   /** Whether the line is horizontal or vertical. */
  58.   protected boolean _is_horiz;
  59.  
  60.   /** 
  61.    * Whether the line is horizontal or vertical. 
  62.    * @return boolean true if the line is horizontal, false if its vertical. 
  63.    */
  64.   public boolean is_horiz() {return _is_horiz;}
  65.  
  66.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  67.  
  68.   /** 
  69.    * Draw the line.
  70.    * @param drawable d the drawable to render this object on
  71.    */
  72.   protected void draw_self_local(drawable d)
  73.     {
  74.       d.drawLine(0,0,w()-1,h()-1);
  75.     }
  76.  
  77.    //had:
  78.    //* @exception general PROPAGATED
  79.  
  80.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  81.  
  82.   /** 
  83.    * Indicate that we intrinsically constrain either height or width depending
  84.    * on our orientation.
  85.    * @return int bitset indicating intrinsically constrained dimension.
  86.    */
  87.   public int intrinsic_constraints() {
  88.     if (is_horiz())
  89.       return H;
  90.     else
  91.       return W;
  92.   }
  93.  
  94.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  95. }
  96. /*=========================== COPYRIGHT NOTICE ===========================
  97.  
  98. This file is part of the subArctic user interface toolkit.
  99.  
  100. Copyright (c) 1996 Scott Hudson and Ian Smith
  101. All rights reserved.
  102.  
  103. The subArctic system is freely available for most uses under the terms
  104. and conditions described in 
  105.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  106. and appearing in full in the lib/interactor.java source file.
  107.  
  108. The current release and additional information about this software can be 
  109. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  110.  
  111. ========================================================================*/
  112.